package com.ruoyi.tester.executor;

import java.util.HashMap;
import java.util.Map;

/**
 * @author SongJun
 * @description TODO:
 * @date 2022/5/16 11:16
 */
public class AnalysisResult {
    int slotNum = 0;
    Object[] va;
    Map<String, Object> vm;

    public AnalysisResult(int returnNum){
        va = new Object[returnNum];
        vm = new HashMap<>();
    }

    public synchronized void add(String k, Object v){
        if(v == null){
            v = new Object();
        }
        if(slotNum < va.length){
            va[slotNum] = v;
            if(k != null){
                vm.put(k, v);
            }
            slotNum ++;
            return;
        }
        throw new RuntimeException(k+":"+v+"数组越界");
    }

    public Object[] getVa() {
        return va;
    }

    public Map<String, Object> getVm() {
        return vm;
    }
}
